<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>登录</title>
	<link rel="stylesheet" type="text/css" href="css/default2.css">
	<link rel="stylesheet" type="text/css" href="css/styles.css">
	<!--[if IE]>
		<script src="http://libs.baidu.com/html5shiv/3.7/html5shiv.min.js"></script>
	<![endif]-->
	<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
	<article class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>登录</h1>
			<div class="htmleaf-links">
				
			</div>
		</header>
		<div class="panel-lite">
		  <div class="thumbur">
		    <div class="icon-lock"></div>
		  </div>
		  <h4>用户登录</h4>
		  <div class="form-group">
		    <input required="required" class="form-control" id="user"/>
		    <label class="form-label">用户名    </label>
		  </div>
		  <div class="form-group">
		    <input type="password" required="required" class="form-control" id="password"/>
		    <label class="form-label">密　码</label>
		  </div><a href="#">忘记密码 ?  </a>
		  <button class="floating-btn" onclick="login()"><i class="icon-arrow"></i></button>
		</div>
		
	</article>
	<script>
		function login(){
			var u = $("#user").val();
			var p = $("#password").val();
	  		$.ajax({
	  		    url: 'https://zlb.safeok.net.cn/portal/user/login',
	  		    type: 'post',
	  	   		// dataType: 'json',
	  	   		async : false,//需要改成同步的
	  	   		data:JSON.stringify({
	  	   			'name':u,
		  	   		'password':p
	  	   		}),
	  	   		contentType: "application/json;charset=utf-8",
	  	   		success:function(res){
	  	   			window.location.replace("index.html");
	  	   			// console.log(111111);
	  	   		},
	  	   		error:function(res){
	  	   			// console.log(222);
	  	   		},
	  		})
		}
  		
	</script>
</body>
</html>